<template>
	<el-config-provider :locale="locale" :size="config.size" :zIndex="config.zIndex" :button="config.button">
		<router-view></router-view>
	</el-config-provider>
</template>

<script>
	import colorTool from '@/utils/color'

	export default {
		name: 'App',
		data() {
			return {
				config: {
					size: "default",
					zIndex: 2000,
					button: {
						autoInsertSpace: false
					}
				}
			}
		},
		computed: {
			locale(){
				return this.$i18n.messages[this.$i18n.locale].el
			},
		},
		created() {
			//设置主题颜色
			const app_color = this.$CONFIG.COLOR || this.$TOOL.data.get('APP_COLOR')
			if(app_color){
				document.documentElement.style.setProperty('--el-color-primary', app_color);
				for (let i = 1; i <= 9; i++) {
					document.documentElement.style.setProperty(`--el-color-primary-light-${i}`, colorTool.lighten(app_color,i/10));
				}
				for (let i = 1; i <= 9; i++) {
					document.documentElement.style.setProperty(`--el-color-primary-dark-${i}`, colorTool.darken(app_color,i/10));
				}
			}
			//在vue3中使用element-plus页面重置报ResizeObserver loop completed with undelivered notifications.
			const debounce = (fn, delay) => {
				let timer = null;
				return function () {
					let context = this;
					let args = arguments;
					clearTimeout(timer);
					timer = setTimeout(function () {
						fn.apply(context, args);
					}, delay);
				}
			}
			const _ResizeObserver = window.ResizeObserver;
			window.ResizeObserver = class ResizeObserver extends _ResizeObserver {
				constructor(callback) {
					callback = debounce(callback, 16);
					super(callback);
				}
			}
		}
	}
</script>

<style lang="scss">
	@import '@/style/style.scss';
    .el-radio.el-radio--large{
        height: 0;
    }
    .el-input-group__append{
        color: #098;
        // font-size: 16px;
    }
    .el-tag{
        cursor: pointer;
    }
    .finish{
        display: flex;
        align-items: center;
        margin-left: 20px;
        .finishNum{
            font-size: 22px;
            display: flex;
            align-items: flex-end;
            margin-right:30px;

        }
        .text{
            font-size: 20px;
            color: #409EFF;
            margin-left: 10px;
            font-weight: 600;
        }
    }
    #hiwprint_iframe{
        display: none;
    }
    // div,.el-tag{
    //     font-size: 16px;
    // }
    div{
        color: #000;
    }
    .el-link{
        color: #06c;
    }
    button{
        // border: 1px solid #333 !important;
        span{
            font-size: 14px !important;
            // color: #000;
        }
    }
    // 设置除primary、warning、danger之外的按钮样式为黑色
    .el-button:not(.el-button--primary):not(.el-button--warning):not(.el-button--danger):not(.el-button--info):not(.el-button--success) {
        border: 1px solid #000 !important;
        span {
            color: #000 !important;
        }
    }
    .sc-form-table .el-table tfoot tr > td div {
        font-weight: 800;
        font-size: 18px !important;
    }
    .el-button,.el-link{
        font-size: 16px !important;
    }
    .formtable {
        .el-input__wrapper {
            padding: 0 5px !important;
        }
        .el-table .cell {
            padding: 2px !important;
        }
        .el-table__row td {
            padding: 2px !important;
        }
        .el-table--border .el-table__cell {
            border-color: #c0bdbd !important;
        }
    }
    .operation{
        display: grid;
        gap: 8px;
        .el-button {
            margin: 0;
        }
}
.icon{
    cursor: pointer;
}
.four{
    grid-template-columns: repeat(4, 1fr);
}
.three {
    grid-template-columns: repeat(3, 1fr);
}
.two {
    grid-template-columns: repeat(2, 1fr);
}
.buttonFlex {
    display: flex;
    justify-content: flex-end;
    button {
        margin-left: 5px !important;
        margin-bottom: 5px;
    }
}
.start{
    justify-content: flex-start !important;
}
.flex{
    display: flex;
    align-items: center;
}
.column{
    display: flex;
    flex-direction: column;
    align-items: center;
    button {
        margin-left: 0!important;
    }
}
// 虚拟表格边框
.el-table-v2__header-cell ,.el-table-v2__row-cell{
    border-left: 0.5px solid #c0bdbd;
    border-right: 0.5px solid #c0bdbd;
    border-bottom: 1px solid #888;
}
.el-table-v2__header-wrapper{
    border-top: 1px solid #c0bdbd;
    border-bottom: 1px solid #c0bdbd;
}

.print_flex{
    display: flex;
    align-items: center;
    justify-content: space-between;
}
</style>
